using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Decisions.HL7.Message;
using DecisionsFramework;

namespace Decisions.HL7.Message
{
    public class EventRelatedPeriodAttribute:RuleAttribute
    {
        private Dictionary<HL7Version, string[]> validVersionCodes = new Dictionary<HL7Version, string[]>();
        private Dictionary<HL7Version, string[]> validVersionDescriptions = new Dictionary<HL7Version, string[]>();
        private Dictionary<HL7Version, HL7TableType> tableVersionTypes = new Dictionary<HL7Version, HL7TableType>();

        public EventRelatedPeriodAttribute()
        {
            // init the values for table version types
						tableVersionTypes[HL7Version.v25] = HL7TableType.HL7;
						tableVersionTypes[HL7Version.v251] = HL7TableType.HL7;
						tableVersionTypes[HL7Version.v26] = HL7TableType.HL7;
						tableVersionTypes[HL7Version.v27] = HL7TableType.HL7;
			
            
			// init the values for version codes
						validVersionCodes[HL7Version.v25] = new string[]{"HS","AC","PC","IC","ACM","ACD","ACV","PCM","PCD","PCV","ICM","ICD","ICV"};
						validVersionCodes[HL7Version.v251] = new string[]{"HS","AC","PC","IC","ACM","ACD","ACV","PCM","PCD","PCV","ICM","ICD","ICV"};
						validVersionCodes[HL7Version.v26] = new string[]{"HS","AC","PC","IC","ACM","ACD","ACV","PCM","PCD","PCV","ICM","ICD","ICV"};
						validVersionCodes[HL7Version.v27] = new string[]{"HS","AC","PC","IC","ACM","ACD","ACV","PCM","PCD","PCV","ICM","ICD","ICV"};
			
			// init the values for version descriptions
						validVersionDescriptions[HL7Version.v25] = new string[]{"the hour of sleep (e.g., H18-22)","before meal (from lat. ante cibus)","after meal (from lat. post cibus)","between meals (from lat. inter cibus)","before breakfast (from lat. ante cibus matutinus)","before lunch (from lat. ante cibus diurnus)","before dinner (from lat. ante cibus vespertinus)","after breakfast (from lat. post cibus matutinus)","after lunch (from lat. post cibus diurnus)","after dinner (from lat. post cibus vespertinus)","between breakfast and lunch","between lunch and dinner","between dinner and the hour of sleep"};
						validVersionDescriptions[HL7Version.v251] = new string[]{"the hour of sleep (e.g., H18-22)","before meal (from lat. ante cibus)","after meal (from lat. post cibus)","between meals (from lat. inter cibus)","before breakfast (from lat. ante cibus matutinus)","before lunch (from lat. ante cibus diurnus)","before dinner (from lat. ante cibus vespertinus)","after breakfast (from lat. post cibus matutinus)","after lunch (from lat. post cibus diurnus)","after dinner (from lat. post cibus vespertinus)","between breakfast and lunch","between lunch and dinner","between dinner and the hour of sleep"};
						validVersionDescriptions[HL7Version.v26] = new string[]{"the hour of sleep (e.g., H18-22)","before meal (from lat. ante cibus)","after meal (from lat. post cibus)","between meals (from lat. inter cibus)","before breakfast (from lat. ante cibus matutinus)","before lunch (from lat. ante cibus diurnus)","before dinner (from lat. ante cibus vespertinus)","after breakfast (from lat. post cibus matutinus)","after lunch (from lat. post cibus diurnus)","after dinner (from lat. post cibus vespertinus)","between breakfast and lunch","between lunch and dinner","between dinner and the hour of sleep"};
						validVersionDescriptions[HL7Version.v27] = new string[]{"the hour of sleep (e.g., H18-22)","before meal (from lat. ante cibus)","after meal (from lat. post cibus)","between meals (from lat. inter cibus)","before breakfast (from lat. ante cibus matutinus)","before lunch (from lat. ante cibus diurnus)","before dinner (from lat. ante cibus vespertinus)","after breakfast (from lat. post cibus matutinus)","after lunch (from lat. post cibus diurnus)","after dinner (from lat. post cibus vespertinus)","between breakfast and lunch","between lunch and dinner","between dinner and the hour of sleep"};
			            

        }

        
        public override ValidationIssue[] RunRule(string name, object owningObject, object value)
        {
            //todo: check if the value is valid in the current version
            //if the value is not valid in the current version, add it as a validation issue


            return new ValidationIssue[0];
        }
    }
}
